<!--  -->
<template>
  <div class="shdizhi">
    <van-nav-bar
      :title="fdfffddf ? '我的收货地址' : '请选择收货地址' "
      left-text="返回"
        fixed
      @click-left="$router.back()"
    >
    </van-nav-bar>
    <van-address-list
     class="jjgd"
      :list="list"
      :switchable="!fdfffddf"
      @add="$router.push({path:'/xinzengdizhi',query:{vv:'xize'}})"
      @edit="fdfdjfjfj"
      @select="gfgfff"
      
     
     
     
    />
  </div>
</template>

<script>
import { mapState } from "vuex";
export default {
name:'',
  data () {
    return {
        
        
      list: [
       
      ],
    } 
  },
 


  computed: {
      ...mapState(['userInfo']),
      fdfffddf(){
          return this.$route.query.df=='me'
      }
      
  },

created(){
   
    let{addressList}=this.userInfo
    addressList.forEach(item=>{
        let{id,name,mobile:tel,province,city,country,detail}=item
        
        this.list.push({id,name,tel,address:`${province} ${city} ${country} ${detail}`})
    })
      
},
  methods: {
    fdfdjfjfj(item){
     
      this.$router.push({
        path:"/xinzengdizhi",
        query:{
          vv:item.id
        }
      })
    },
    gfgfff(item){
      if(!this.fdfffddf){
        this.$router.push({
        path:"/orderdd",
        query:{
          id:item.id
        }
      })
      }
   
    }
  }
}

</script>
<style lang='less' scoped>
</style>